﻿using BCData.OA.Attendance.AttendanceRemedyApply;
using BCDto.MySql.Admin;
using BCDto.OA.Attendance.AttendanceRemedyApply;
using BCService.Utils;
using System.Collections.Generic;

namespace BCService.OA.Attendance.AttendanceRemedyApply
{
    /// <summary>
    /// 补卡申请记录信息
    /// </summary>
    public class AttendanceRemedyApplyService : IAttendanceRemedyApplyService
    {
        private IAttendanceRemedyApplyData attendanceRemedyApplyData;

        public AttendanceRemedyApplyService(IAttendanceRemedyApplyData attendanceRemedyApplyData)
        {
            this.attendanceRemedyApplyData = attendanceRemedyApplyData;
        }
        /// <summary>
        ///  获取指定的补卡申请信息
        /// </summary>
        /// <param name="remedyApplyId">补卡申请Id</param>
        /// <returns></returns>
        public AttendanceRemedyApplyDto GetById(long remedyApplyId)
        {
            return attendanceRemedyApplyData.GetByIdAsync(remedyApplyId).GetAwaiter().GetResult().As<AttendanceRemedyApplyDto>();
        }
        /// <summary>
        /// 获取当前员工下的补卡申请
        /// </summary>
        /// <param name="admin"></param>
        /// <returns></returns>
        public List<AttendanceRemedyApplyDto> GetList(AdminDto admin)
        {
           return attendanceRemedyApplyData.GetEntitiesAsync(admin.AdminId).GetAwaiter().GetResult().As< List<AttendanceRemedyApplyDto>>();
        }
    }
}
